/* file name  : STUNTEventListener.java
 * created    : Sat 24 Sep 2005 03:50:13 PM EDT
 * authors    : Saikat Guha <saikat@cs.cornell.edu>
 * copyright  : GNU Lesser General Public License version 2.1 or later
 *
 * Copyright (C) 2005 Saikat Guha <saikat@cs.cornell.edu>
 *
 * This library is free software; you can redistribute it and/or modify it under the terms
 * of the GNU Lesser General Public License as published by the Free Software Foundation;
 * either version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License along with this
 * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307 USA
 *
 */
package net.nutss.stunt;

import java.net.Socket;
import java.net.URI;

/**
 * The listener interface for receiving socket events.
 *
 * @author Saikat Guha
 * @version %I%, %G%
 */
public interface STUNTEventListener {

    /**
     * Called when an error occus on the socket
     *
     * @param e the execption throwns
     */
    void errorHandler(Exception e);

    /**
     * Called when a socket is accepted by a server
     *
     * @param s Accepted socket
     * @param u URI of the remotee endpoint
     * @deprecated Please now use acceptTCPHandler() or
     * acceptUDPHandler()
     */
    void acceptHandler(Socket s, URI u);

    /**
     * Called when a socket successfully connects.
     *
     * @param s the connected socket
     * @deprecated Please now use connectTCPHandler() or
     * connectUDPHandler()
     */
    void connectHandler(Socket s);

    /**
     * Called when a TCP socket is accepted by a server
     *
     * @param s Accepted socket
     * @param u URI of the remotee endpoint
     */
    void acceptTCPHandler(Socket s, URI u);

    /**
     * Called when a TCP socket successfully connects.
     *
     * @param s the connected socket
     */
    void connectTCPHandler(Socket s);

    /**
     * Called when a UDP socket is accepted by a server
     *
     * @param s Accepted socket
     * @param u URI of the remotee endpoint
     */
    void acceptUDPHandler(STUNTUDPSocket s, URI u);

    /**
     * Called when a UDP socket successfully connects.
     *
     * @param s the connected socket
     */
    void connectUDPHandler(STUNTUDPSocket s);
}
